//
//  OrderMenuCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/30.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "OrderMenuCell.h"

@implementation OrderMenuCell

- (void)awakeFromNib {
    [super awakeFromNib];

//    WEAKSELF
//    [self.selectMenuControl addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
//        if (weakSelf.OrderMenuCellBlock) {
//            weakSelf.OrderMenuCellBlock(OrderMenuCellActionType_sel);
//        }
//    }];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.mainImageView pp_clipCorners:UIRectCornerAllCorners radius:6];
    });
}

- (void)fillCellWithModel:(CommonMenuModel *)model AndSubmitModel:(SubmitSerOrderModel *)submitModel {

    [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:model.bhmTransverseImg] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    self.mainTitleLab.text = model.bhmMenuName;
    self.subTitleLab.text = model.bhmRemark;
    self.priceLab.text = [NSString stringWithFormat:@"¥%@/桌",[Utilities changeDoubleToString:model.bhmMenuPrice]];

    self.countTF.text = [NSString stringWithFormat:@"%ld",(long)submitModel.bySellerVoList.firstObject.byGoodsVoList.firstObject.goodsNum];
}

- (IBAction)addAction:(id)sender {
    if (self.OrderMenuCellBlock) {
        self.OrderMenuCellBlock(OrderMenuCellActionType_add);
    }
}

- (IBAction)cutAction:(id)sender {
    if (self.OrderMenuCellBlock) {
        self.OrderMenuCellBlock(OrderMenuCellActionType_cut);
    }
}


@end
